package com.location.footprint.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.location.footprint.R;
import com.location.footprint.adapter.CommentsAdapter;
import com.location.footprint.bean.CommentsBean;
import com.location.footprint.bean.DataProvider;
import com.location.footprint.manager.DividerDecoration;
import com.location.footprint.utils.Utils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class LikesFragment extends BaseFragment {
    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;
    Unbinder unbinder;
    private String mTitle;
    private CommentsAdapter hAdapter;

    public static LikesFragment getInstance(String title) {
        LikesFragment sf = new LikesFragment();
        sf.mTitle = title;
        return sf;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_hot_footprint;
    }

    @Override
    protected void initView() {
        recyclerview.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerview.setHasFixedSize(true);
        //color & height & paddingLeft & paddingRight
        DividerDecoration itemDecoration = new DividerDecoration(getContext().getResources().getColor(R.color.divider_gray), Utils.dip2px(getContext(), 1), Utils.dip2px(getContext(), 10), 10);
        recyclerview.addItemDecoration(itemDecoration);
        List<CommentsBean> data = DataProvider.getCommentsList(2);
        hAdapter = new CommentsAdapter(data);
        recyclerview.setAdapter(hAdapter);
        hAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {

            }
        });

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        return rootView;
    }
}